<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户管理</title>
    <link th:href="@{lib/layui/css/layui.css}" rel="stylesheet">
    <script th:src="@{lib/layui/layui.js}"></script>
    <script th:src="@{js/utilities.js}"></script>
    <link th:href="@{css/user.css}" rel="stylesheet">
    <script th:src="@{js/user.js}"></script>
</head>
<body>


<table class="layui-hide" id="user-table" lay-filter="user"></table>

<button id="new-user" type="button" class="layui-btn layui-btn-sm fab" lay-on="user-add">新增用户</button>

<script type="text/html" id="user-table-operator-template">
    <div class="layui-clear-space">
<!--        <a class="layui-btn layui-btn-xs" lay-event="save">保存</a>-->
        <a class="layui-btn layui-btn-xs" lay-event="delete">删除</a>
    </div>
</script>

<script type="text/html" id="user-table-role-template">
    <button class="layui-btn layui-btn-primary dropdown-role">
        <span>{{= d.role === "ADMIN" ? "管理员" : d.role === "ASKER" ? "提问者" : "回答者" }}</span>
        <i class="layui-icon layui-icon-down layui-font-12"></i>
    </button>
</script>

<div id="add-user-layer">
    <form id="add-user-form" class="layui-form">
        <div class="layui-form-item">
            <label class="layui-form-label">角色</label>
            <div class="layui-input-block">
                <select name="role" lay-verify="required" lay-filter="role">
                    <option value="ADMIN" selected>管理员</option>
                    <option value="ASKER">提问者</option>
                    <option value="RESPONDER">回答者</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-block">
                <input type="text" name="username" lay-verify="required|cookiestr" placeholder="账号名" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">密码</label>
            <div class="layui-input-block">
                <input type="password" name="password" value="" lay-verify="required|cookiestr" placeholder="密   码" lay-reqtext="请填写密码" autocomplete="off" class="layui-input" lay-affix="eye">
            </div>
        </div>
        <div class="layui-form-item" style="text-align: center">
            <button class="layui-btn" lay-submit lay-filter="add-user">确认</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            <button type="button" class="layui-btn layui-btn-primary" lay-on="close-user-add">取消</button>
        </div>
    </form>
</div>
</body>
</html>